
module.exports = app => {

  const apiChatRouter = app.router.namespace('/api/chat');

  const { controller, middleware } = app;

  const {
    chat, api
  } = controller;

  const tokenRequired = middleware.tokenRequired();

  apiChatRouter.post('/simpleLogin.json', api.user.simpleLogin);
  apiChatRouter.get('/getUserList.json', chat.getUserList);

  apiChatRouter.get('/getRoom.json', tokenRequired, chat.getRoom);
  apiChatRouter.get('/getRoomList.json', tokenRequired, chat.getRoomList);
  
  apiChatRouter.get('/getMessageList.json', tokenRequired, chat.getMessageList);
  apiChatRouter.post('/send.json', tokenRequired, chat.send);
}